#-------------------------------------------------
#
# Project created by QtCreator 2014-11-21T17:55:39
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = usbdemo
TEMPLATE = app


win32{
    COPY = copy /y
    MKDIR = mkdir
}else{
    COPY = cp
    MKDIR = mkdir -p
}
defineTest(copyToDestdir){
    files = $$1
    DSTDIR = $$2

    for(FILE, files) {
        DDIR = $$DSTDIR
        win32:FILE ~= s,/,\\,g
        win32:DDIR ~= s,/,\\,g

        QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
    }
    export(QMAKE_POST_LINK)
}

defineTest(makeDir){
    DSTDIR = $$1
    DDIR = $$DSTDIR
    !exists($$DDIR){
        win32:DDIR ~= s,/,\\,g
        system($$MKDIR $$quote($$DDIR) $$escape_expand(\\n\\t))
    }
}
win32 {
    DEFINES += _CRT_SECURE_NO_WARNINGS
    !contains(QMAKE_TARGET.arch, x86_64) {
        ARCH = x86## Windows x86 (32bit) specific build here
    } else {
        ARCH = x64 ## Windows x64 (64bit) specific build here
    }

    CONFIG(debug, debug|release): BUILD = debug

    CONFIG(release, debug|release){
        BUILD=release
        QMAKE_CFLAGS_RELEASE += -zi
        QMAKE_LFLAGS_RELEASE += /DEBUG
    }

    LIBS += -lkernel32
win32-msvc*:LIBS += -lole32 -lshell32 -ladvapi32 -limm32
win32-msvc*:LIBS +=$$PWD/../libs/msvc/libusb.lib
message(-------$$LIBS)

    INCLUDEPATH +=  $$PWD/../includes
DESTDIR = $$PWD/../build
    !exists($$DESTDIR):makeDir($$DESTDIR)
#copy dll
    dist = $$DESTDIR
    copyToDestdir($$PWD/../bin/$$ARCH/*,$$dist)
}

SOURCES += main.cpp\
        widget.cpp

HEADERS  += widget.h

FORMS    += widget.ui
